Create Directories

back to section start!

 
  1createdirs: 
  2  parse arg subdir 
  3  dirstocreate = 'T:ArcDir'handle'/'arcsubdir||subdir 
  4  here = 0 
  5  do until here = 0 
  6    here = pos('/',dirstocreate,here + 1) 
  7    if here > 0 then 
  8      call makedir(left(dirstocreate,here - 1)) 
  9    end 
 10  return 
 
Line: 
 1      Sub-routine label. 
 2      We get the directory that was passed to the routine and assign 
        subdir to it. 
 3      We set dirstocreate to the complete path in T: of the directory we 
        are going to create, for example if we wanted to create a directory 
        called 'help' under a sub-directory of 'wanted' then 'dirstocreate' 
        will be 'T:ArcDir12345678/wanted/help/'.  The ArcDir12345678 is the 
        unique name of the handler associated with this lister from the 
         here . 
 4      Set here to 0. 
 5 - 9  This loop cycles around creating the directories a sub-level at a 
        time.  With the example in line 3 above, it would first create 
        T:ArcDir12345678/, then T:ArcDir12345678/wanted/, then 
        T:ArcDir12345678/wanted/help/. 
10      We return. 
 

DOpus PLUS - giving you that bit extra...